public class Main1715 {
    public static void main(String[] args) {
        for (int i = 1000; i < 10000; i++) {
            int a = i / 1000;//
            int b = i / 100 % 10;//2
            int c = i % 100 / 10;//3
            int d = i % 100 % 10;//4
            int x = a + b;
            int y = c + d;

            if (x % 2 == 0 && y % 2 == 1 && x > y&&i % 8 == 0) {
                    System.out.println(i);
                }
            }
        }
    }

